package cn.iocoder.yudao.module.biz.dal.mysql.emergencyReservePlainDrillRecord;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlainDrillRecord.vo.BizEmergencyReservePlainDrillRecordExportReqVO;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlainDrillRecord.vo.BizEmergencyReservePlainDrillRecordPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.emergencyReservePlainDrillRecord.BizEmergencyReservePlainDrillRecordDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 演练记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizEmergencyReservePlainDrillRecordMapper extends BaseMapperX<BizEmergencyReservePlainDrillRecordDO> {

    default PageResult<BizEmergencyReservePlainDrillRecordDO> selectPage(BizEmergencyReservePlainDrillRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizEmergencyReservePlainDrillRecordDO>()
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillId, reqVO.getDrillId())
                .likeIfPresent(BizEmergencyReservePlainDrillRecordDO::getReservePlainName, reqVO.getReservePlainName())
                .likeIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillName, reqVO.getDrillName())
                .betweenIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillTime, reqVO.getBeginDrillTime(), reqVO.getEndDrillTime())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getAddress, reqVO.getAddress())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getParticipant, reqVO.getParticipant())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillPlainFileUrl, reqVO.getDrillPlainFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getExerciseProgramFileUrl, reqVO.getExerciseProgramFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getSignInFileUrl, reqVO.getSignInFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getVideoMaterialFileUrl, reqVO.getVideoMaterialFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getSummarize, reqVO.getSummarize())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getEvaluateFileUrl, reqVO.getEvaluateFileUrl())
                .orderByDesc(BizEmergencyReservePlainDrillRecordDO::getId));
    }

    default List<BizEmergencyReservePlainDrillRecordDO> selectList(BizEmergencyReservePlainDrillRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizEmergencyReservePlainDrillRecordDO>()
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillId, reqVO.getDrillId())
                .likeIfPresent(BizEmergencyReservePlainDrillRecordDO::getReservePlainName, reqVO.getReservePlainName())
                .likeIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillName, reqVO.getDrillName())
                .betweenIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillTime, reqVO.getBeginDrillTime(), reqVO.getEndDrillTime())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getAddress, reqVO.getAddress())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getParticipant, reqVO.getParticipant())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getDrillPlainFileUrl, reqVO.getDrillPlainFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getExerciseProgramFileUrl, reqVO.getExerciseProgramFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getSignInFileUrl, reqVO.getSignInFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getVideoMaterialFileUrl, reqVO.getVideoMaterialFileUrl())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getSummarize, reqVO.getSummarize())
                .eqIfPresent(BizEmergencyReservePlainDrillRecordDO::getEvaluateFileUrl, reqVO.getEvaluateFileUrl())
                .orderByDesc(BizEmergencyReservePlainDrillRecordDO::getId));
    }

    default List<BizEmergencyReservePlainDrillRecordDO> selectListByIds(List<String> reserveIds){
        return selectList(new LambdaQueryWrapper<BizEmergencyReservePlainDrillRecordDO>().in(BizEmergencyReservePlainDrillRecordDO::getReservePlainId,reserveIds));
    }
}
